<div class="tabbable tabs-left">
              <ul class="nav nav-tabs">
              	<li><h5><?php echo $this->translate('客户信息'); ?></h5></li>
                <!-- <li class="active"><a data-toggle="tab" href="#user_c"><?php echo $this->translate('客户总览'); ?></a></li> -->
                <li class="active"><a data-toggle="tab" href="#user_a"><?php echo $this->translate('基本信息'); ?></a></li>
                 <?php if($this->user_info) { ?>
                <li class=""><a data-toggle="tab" href="#user_b"><?php echo $this->translate('地址信息'); ?></a></li>
                <li><a data-toggle="tab" href="#user_e"><?php echo $this->translate('客户订单'); ?></a></li>
                <li><a data-toggle="tab" href="#user_f"><?php echo $this->translate('产品评价'); ?></a></li>
                <li><a data-toggle="tab" href="#user_g"><?php echo $this->translate('邮件信息'); ?></a></li>
                <!-- <li><a data-toggle="tab" href="#user_h"><?php echo $this->translate('购物车信息'); ?></a></li> -->
                <li><a data-toggle="tab" href="#user_i"><?php echo $this->translate('收藏商品'); ?></a></li>
                <?php } ?>
              </ul>
              <form class="form-horizontal" enctype="multipart/form-data" name="user_add_form" id="user_add_form" method="post" action="">
              <input type="hidden" name="user_save_type" id="user_save_type" value="">
              <input type="hidden" name="user_id" id="user_id" value="<?php echo ($this->user_info ? $this->user_info->user_id : ''); ?>">
              <div class="tab-content">
    			<div id="sticky_navigation" style="height:30px;border-bottom:4px solid #DFDFDF;">
        			<div class="pull-left" style="font-size:16px;line-height:30px;"><strong><?php echo (isset($this->user_info) ? $this->translate('编辑') : $this->translate('新加')) . $this->translate('客户'); ?></strong></div>
        			<div class="pull-right">
                	<a href="<?php echo $this->url('user/default/page',array('action'=>'index', 'controller'=>'user', 'page'=>$this->page), array('query'=>$this->query)); ?>" class="btn btn-small"><i class="icon-arrow-left"></i> <?php echo $this->translate('返回客户列表'); ?></a>&nbsp;
                	<a href="<?php echo $this->serverUrl(true); ?>" class="btn btn-small btn-warning"><i class="icon-repeat icon-white"></i> <?php echo $this->translate('刷新'); ?></a>&nbsp;
                    <?php if($this->user_info) { ?>
                    <a href="javascript:;" onclick="return user_del_js(<?php echo $this->user_info->user_id ?>);" class="btn btn-small btn-danger"><i class="icon-remove icon-white"></i> <?php echo $this->translate('删除客户'); ?></a>&nbsp;
                    <button type="submit" onclick="$('#user_save_type').val('save_return_edit');" class="btn btn-small btn-primary"><i class="icon-ok icon-white"></i> <?php echo $this->translate('保存客户信息并继续编辑'); ?></button>&nbsp;
                    <?php } ?>
                	<button type="submit" onclick="$('#user_save_type').val('');" class="btn btn-small btn-primary"><i class="icon-ok icon-white"></i> <?php echo $this->translate('保存客户信息'); ?></button>&nbsp;
                	<a href="<?php echo $this->myviewalias()->dbshopHelpUrl('user_add'); ?>" target="_blank" class="btn btn-small btn-info"><i class="icon-info-sign icon-white"></i> <?php echo $this->translate('查看帮助说明'); ?></a>
                	</div>
        		</div>
                <div id="user_a" class="tab-pane active">
                	<div class="well admin_add_header_well"><?php echo $this->translate('基本信息'); ?></div>
                	<div class="well admin_add_well">
                	    <div class="message_one">
                    	</div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('头像'); ?>：</label>
           					<div class="controls">
                            	<?php if(isset($this->user_info) and !empty($this->user_info->user_avatar)) { ?>
                                <img src="<?php echo $this->basePath($this->user_info->user_avatar); ?>" />
                                <input type="hidden" name="old_user_avatar" id="old_user_avatar" value="<?php echo $this->user_info->user_avatar; ?>" />
                                <?php } else { ?>
                                <img src="<?php echo $this->basePath($this->frontwebsite()->getUserIni('default_avatar')); ?>" />
                                <?php } ?>
              					<input type="file" name="user_avatar" id="user_avatar" />
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('消费积分'); ?>：</label>
           					<div class="controls">
								<p style="padding-top: 5px;">
                            	<?php if(isset($this->user_info) and $this->user_info->user_integral_num > 0) {
								echo $this->user_info->user_integral_num;
                                } else { ?>
                                0
                                <?php } ?>
                                <?php echo $this->translate('积分'); ?>
								</p>
            				</div>                        
                        </div>
						<div class="control-group">
							<label for="input01" class="control-label"><?php echo $this->translate('等级积分'); ?>：</label>
							<div class="controls">
								<p style="padding-top: 5px;">
									<?php if(isset($this->user_info) and $this->user_info->integral_type_2_num > 0) {
										echo $this->user_info->integral_type_2_num;
									} else { ?>
										0
									<?php } ?>
									<?php echo $this->translate('积分'); ?>
								</p>
							</div>
						</div>
						<div class="control-group">
							<label for="input01" class="control-label"><?php echo $this->translate('客户余额'); ?>：</label>
							<div class="controls">
								<p style="padding-top: 5px;">
								<?php if(isset($this->user_info) and $this->user_info->user_money > 0) {
									echo $this->user_info->user_money;
								} else { ?>
									0
								<?php } ?>
								</p>
							</div>
						</div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('客户分组'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
              					<select id="group_id" name="group_id" class="span2">
                                <option value=""><?php echo $this->translate('请选择'); ?></option>
                                <?php if($this->group_array) {
                                	foreach ($this->group_array as $group_val) {
                                ?>
                                <option value="<?php echo $group_val['group_id']; ?>" <?php if($this->user_info and $this->user_info->group_id==$group_val['group_id']) { echo 'selected="selected"'; } ?>><?php echo $group_val['group_name']; ?></option>
                                <?php }
                                }
                                ?>
                                </select>
								<font color="red"><?php echo $this->translate('变更客户分组时，请先确定要变更的分组没有开启等级积分范围或者当前用户的等级积分符合要求，否则客户前台登录会自动变回原分组'); ?></font>
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('登录名称'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
              					<input type="text" id="user_name"  name="user_name" value="<?php echo ($this->user_info ? $this->escapeHtml($this->user_info->user_name) : ''); ?>" <?php echo ($this->user_info ? 'readonly="readonly"' : ''); ?> class="span6">
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('性别'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
              					<select id="user_sex" name="user_sex" class="span2">
                                <option value="3" <?php if($this->user_info and $this->user_info->user_sex==3) { echo 'selected="selected"'; } ?>><?php echo $this->translate('保密'); ?></option>
                                <option value="1" <?php if($this->user_info and $this->user_info->user_sex==1) { echo 'selected="selected"'; } ?>><?php echo $this->translate('男'); ?></option>
                                <option value="2" <?php if($this->user_info and $this->user_info->user_sex==2) { echo 'selected="selected"'; } ?>><?php echo $this->translate('女'); ?></option>
                                </select>
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('生日'); ?>：</label>
           					<div class="controls">
              					<input type="text" id="user_birthday"  name="user_birthday" value="<?php echo ($this->user_info ? $this->escapeHtml($this->user_info->user_birthday) : ''); ?>" onclick="WdatePicker({el:'user_birthday'})" class="span3 Wdate">
            				</div>                        
                        </div>
						<?php
						$userEmailRegisterState = $this->frontwebsite()->getRegOrLoginIni('register_email_state');
						$userPhoneRegisterState = $this->frontwebsite()->getRegOrLoginIni('register_phone_state');
						?>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('电子邮件'); ?>
								<?php if ($userEmailRegisterState == 'true') { ?>
									<span class="must_add_value">*</span>
								<?php } ?>
								：</label>
           					<div class="controls">
              					<input type="text" id="user_email"  name="user_email"  value="<?php echo ($this->user_info ? $this->escapeHtml($this->user_info->user_email) : ''); ?>" class="span6">
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('客户密码'); ?><?php if (!$this->user_info) { ?><span class="must_add_value">*</span><?php } ?>：</label>
           					<div class="controls">
              					<input type="password" id="user_password"  name="user_password" class="span3">
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('确认密码'); ?><?php if (!$this->user_info) { ?><span class="must_add_value">*</span><?php } ?>：</label>
           					<div class="controls">
              					<input type="password" id="user_password_con"  name="user_password_con" class="span3">
            				</div>                        
                        </div>
						<div class="control-group">
							<label for="input01" class="control-label"><?php echo $this->translate('手机号码'); ?>
								<?php if ($userPhoneRegisterState == 'true') { ?>
									<span class="must_add_value">*</span>
								<?php } ?>
								：</label>
							<div class="controls">
								<input type="text" id="user_phone"  name="user_phone"  value="<?php echo ($this->user_info ? $this->escapeHtml($this->user_info->user_phone) : ''); ?>" class="span4">
							</div>
						</div>
						<?php if($this->user_reg_extend['inputArray']) {
							foreach($this->user_reg_extend['inputArray'] as $exValue) {
								?>
								<div class="control-group">
									<label for="input01" class="control-label"><?php echo $exValue['field_title']; ?><?php if($exValue['field_null'] == 2) { ?><span class="must_add_value">*</span><?php } ?>：</label>
									<div class="controls">
										<?php echo $exValue['input']; ?>
									</div>
								</div>
							<?php } } ?>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('客户状态'); ?>：</label>
           					<div class="controls">
              					<select name="user_state" id="user_state" class="span1">
                                	<option value="1" <?php if($this->user_info and $this->user_info->user_state == 1) echo 'selected="selected"'; ?>><?php echo $this->translate('开启'); ?></option>
                                    <option value="2" <?php if($this->user_info and $this->user_info->user_state == 2) echo 'selected="selected"'; ?>><?php echo $this->translate('关闭'); ?></option>
                                    <option value="3" <?php if($this->user_info and $this->user_info->user_state == 3) echo 'selected="selected"'; ?>><?php echo $this->translate('待审核'); ?></option>
                                </select>
								<?php if($this->user_info) { ?>
								<input type="hidden" name="hidden_user_state" value="<?php echo $this->user_info->user_state; ?>">
								<?php } ?>
            				</div>                        
                        </div> 
                        <?php if($this->user_info) { ?>                  
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('将密码发给客户'); ?>：</label>
           					<div class="controls">
              					<label class="checkbox inline"><input type="checkbox" name="password_email_notice" value="1" id="password_email_notice"></label>
            				</div>                        
                        </div>
                        <?php } ?>
                                                                                                                       
                  	</div>
                </div>              
                 <div id="user_b" class="tab-pane">
                	<div class="well admin_add_header_well"><?php echo $this->translate('地址信息'); ?></div>
                	<div class="well admin_add_well" id="address_show"  style="padding:2px;">
                                          
                  	</div>                                         	
              </div>
                 
                 <div id="user_c" class="tab-pane">
                	<div class="well admin_add_header_well"><?php echo $this->translate('客户总览'); ?></div>
                	<div class="well admin_add_well" style="padding:2px;">
                                          
                  	</div>                                         	
              </div>
              
                 <div id="user_e" class="tab-pane">
                	<div class="well admin_add_header_well"><?php echo $this->translate('客户订单'); ?></div>
                	<div class="well admin_add_well" id="user_order_show" style="padding:2px;">
                                          
                  	</div>                                         	
              </div>

                 <div id="user_f" class="tab-pane">
                	<div class="well admin_add_header_well"><?php echo $this->translate('产品评价'); ?></div>
                	<div class="well admin_add_well" id="user_comment_show" style="padding:2px;">
                                          
                  	</div>                                         	
              </div>
                                          
                 <div id="user_g" class="tab-pane">
                	<div class="well admin_add_header_well"><?php echo $this->translate('邮件信息'); ?></div>
                	<div class="well admin_add_well" id="email_log_show"  style="padding:2px;">
                                          
                  	</div>                                         	
              </div>
              
                 <div id="user_i" class="tab-pane">
                	<div class="well admin_add_header_well"><?php echo $this->translate('收藏商品'); ?></div>
                	<div class="well admin_add_well" id="favorites_show" style="padding:2px;">
                                          
                  	</div>                                         	
              </div>
                            
             </div>
              </form>
</div>

<?php if ($this->user_info) { ?>
<form class="form-horizontal" name="address_add_form" id="address_add_form" method="post">
<input type="hidden" name="address_id" id="address_id" value="">
<input type="hidden" name="address_user_id" id="address_user_id" value="<?php echo ($this->user_info ? $this->user_info->user_id : ''); ?>">
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><?php echo $this->translate('地址信息添加'); ?></h3>
</div>
<div class="modal-body">
         	<div class="control-group">
				<label class="control-label"><?php echo $this->translate('收货人姓名'); ?><span class="must_add_value">*</span></label>
				<div class="controls">
				<input type="text" id="true_name" name="true_name" class="span6" placeholder="<?php echo $this->translate('填写收货人姓名'); ?>">
				</div>
			</div>
         	<div class="control-group">
				<label class="control-label"><?php echo $this->translate('省市区'); ?><span class="must_add_value">*</span></label>
				<div class="controls" id="region">
				<span id="show_region_value"></span>
				<select id="show_address_area" class="span8">
                	<option value=""><?php echo $this->translate('请选择'); ?></option>
                    <?php if ($this->region_array and !empty($this->region_array )) {
                    	foreach($this->region_array as $value) {
					?>
                    <option value="<?php echo $value['region_id']; ?>"><?php echo $value['region_name']; ?></option>
                    <?php
                    	}
                    }
					?>
                </select>
				<input type="hidden" name="region_id" id="region_id" value="" class="region_ids">
                <input type="hidden" name="region_value" id="region_value" value="" class="region_names" />
				</div>
			</div>
         	<div class="control-group">
				<label class="control-label"><?php echo $this->translate('街道地址'); ?><span class="must_add_value">*</span></label>
				<div class="controls">
				<input type="text" id="address" name="address" class="span12" placeholder="<?php echo $this->translate('填写街道详细地址'); ?>">
				</div>
			</div>
         	<div class="control-group">
				<label class="control-label"><?php echo $this->translate('邮政编码'); ?><span class="must_add_value">*</span></label>
				<div class="controls">
				<input type="text" id="zip_code" name="zip_code" class="span5" placeholder="<?php echo $this->translate('填写邮政编码'); ?>">
				</div>
			</div>
         	<div class="control-group">
				<label class="control-label"><?php echo $this->translate('手机号码'); ?><span class="must_add_value">*</span></label>
				<div class="controls">
				<input type="text" id="mod_phone" name="mod_phone" class="span8" placeholder="<?php echo $this->translate('添加手机号码'); ?>">
				</div>
			</div>
         	<div class="control-group">
				<label class="control-label"><?php echo $this->translate('电话号码'); ?></label>
				<div class="controls">
				<input type="text" id="tel_area_code" name="tel_area_code" class="span2" placeholder="<?php echo $this->translate('区号'); ?>"> - <input type="text" id="tel_phone" name="tel_phone" class="span4" placeholder="<?php echo $this->translate('电话号码'); ?>"> - <input type="text" id="tel_ext" name="tel_ext" class="span2" placeholder="<?php echo $this->translate('分机'); ?>">
				</div>
			</div>
         	<div class="control-group">
				<label class="control-label"><?php echo $this->translate('默认地址'); ?></label>
				<div class="controls">
				<input type="checkbox" value="1" name="addr_default" id="addr_default">
				</div>
			</div> 
        
</div>
<div class="modal-footer">
<!-- button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button -->
<button type="submit" class="btn btn-primary"><?php echo $this->translate('保存修改'); ?></button>
</div>
</div>
</form>
<?php } ?>

<script src="<?php echo $this->basePath('/public/js/DatePicker/WdatePicker.js'); ?>"></script>
<script>
$(document).ready(function() {
	$("#user_add_form").validate({
		rules: {
			group_id: {
				required: true
			},
			<?php if (!$this->user_info) { ?>
			user_name: {
				required: true,
				maxlength:30,
				remote :{
					url : '<?php echo $this->url('frontuser/default/user_id',array('action'=>'check','controller'=>'user','check_type'=>'user_name','user_id'=>($this->user_info ? $this->user_info->user_id : '0'))); ?>',
					type : 'post',
					date : {
						user_name :function(){
							return $('#user_name').val();
						}
					}
				}
			},
			<?php } ?>
			user_email: {
				<?php if ($userEmailRegisterState == 'true') { ?>
				required: true,
				<?php } ?>
				email: true,
				remote :{
					url : '<?php echo $this->url('frontuser/default/user_id',array('action'=>'check','controller'=>'user','module'=>'user','check_type'=>'user_email','user_id'=>($this->user_info ? $this->user_info->user_id : '0'))); ?>',
					type : 'post',
					date : {
						user_email :function(){
							return $('#user_email').val();
						}
					}
				}
			},
			user_password: {
				<?php if (!$this->user_info) { ?>
				required: true,
				<?php } ?>
				minlength: 6,
				maxlength: 20
			},
			user_password_con: {
				<?php if (!$this->user_info) { ?>
				required: true,
				<?php } ?>
				minlength: 6,
				maxlength: 20,
				equalTo: '#user_password'
			},
			user_phone: {
				<?php if ($userPhoneRegisterState == 'true') { ?>
				required: true,
				<?php } ?>
				//isMobile: true,
				remote :{
					url : '<?php echo $this->url('frontuser/default/user_id',array('action'=>'check','controller'=>'user','module'=>'user','check_type'=>'user_phone','user_id'=>($this->user_info ? $this->user_info->user_id : '0'))); ?>',
					type : 'post',
					date : {
						user_phone :function(){
							return $('#user_phone').val();
						}
					}
				}
			}
			<?php if (isset($this->user_reg_extend['jsCheck']['jsStart']) and !empty($this->user_reg_extend['jsCheck']['jsStart'])) { echo ','.implode(',', $this->user_reg_extend['jsCheck']['jsStart']); } ?>
		},
		messages: {
			group_id: {
				required: "<?php echo $this->translate('请选择客户分组'); ?>"
			},
			<?php if (!$this->user_info) { ?>
			user_name: {
				required: "<?php echo $this->translate('请输入客户登录名称！'); ?>",
				maxlength:"<?php echo $this->translate('客户登录名称最长为30个汉字！'); ?>",
				remote: "<?php echo $this->translate('该用户名已经存在！'); ?>"
			},
			<?php } ?>
			user_email: {
				<?php if ($userEmailRegisterState == 'true') { ?>
				required: "<?php echo $this->translate('请输入电子邮箱！'); ?>",
				<?php } ?>
				email: "<?php echo $this->translate('电子邮箱格式错误！'); ?>",
				remote: "<?php echo $this->translate('该邮箱已经存在'); ?>"
			},
			user_password: {
				<?php if (!$this->user_info) { ?>
				required: "<?php echo $this->translate('请输入密码！'); ?>",
				<?php } ?>
				minlength: "<?php echo $this->translate('至少输入6位密码！'); ?>",
				maxlength: "<?php echo $this->translate('密码最长为20位！'); ?>"
			},
			user_password_con: {
				<?php if (!$this->user_info) { ?>
				required: "<?php echo $this->translate('请输入确认密码！'); ?>",
				<?php } ?>
				minlength: "<?php echo $this->translate('至少输入6位确认密码！'); ?>",
				maxlength: "<?php echo $this->translate('确认密码最长为20位！'); ?>",
				equalTo: "<?php echo $this->translate('两次输入的密码不一致！'); ?>"
			},
			user_phone: {
				<?php if ($userPhoneRegisterState == 'true') { ?>
				required: "<?php echo $this->translate('手机号码不能为空！'); ?>",
				<?php } ?>
				//isMobile: "<?php echo $this->translate('请输入正确的手机号码！'); ?>",
				remote: "<?php echo $this->translate('该手机号码已经存在！'); ?>"
			}
			<?php if (isset($this->user_reg_extend['jsCheck']['jsEnd']) and !empty($this->user_reg_extend['jsCheck']['jsEnd'])) { echo ','.implode(',', $this->user_reg_extend['jsCheck']['jsEnd']); } ?>
		},
		submitHandler:function(form){
			check_user_form(form);
		}
	});
<?php if ($this->user_info) { ?>
	//收货地址添加
	$("#address_add_form").validate({
		rules: {
			true_name: {
				required: true,
				maxlength:30
			},
			region_id: {
				required: true
			},
			address: {
				required: true,
				maxlength:80
			},
			mod_phone: {
				required: true
			},
			zip_code: {
				required: true
			}
		},
		messages: {
			true_name: {
				required: "<?php echo $this->translate('请输入收货人姓名！'); ?>",
				maxlength:"<?php echo $this->translate('收货人姓名最长为30个汉字！'); ?>"
			},
			region_id: {
				required: "<?php echo $this->translate('省市区不能为空'); ?>"
			},
			address: {
				required: "<?php echo $this->translate('街道地址不能为空！'); ?>",
				maxlength:"<?php echo $this->translate('街道地址最长90个汉字！'); ?>"
			},
			mod_phone: {
				required: "<?php echo $this->translate('手机号码不能为空！'); ?>"
			},
			zip_code: {
				required: "<?php echo $this->translate('邮政编码不能为空！'); ?>"
			}
		},
		submitHandler:function(form){
			address_save_js();
		}
	});
<?php } ?>
});
function check_user_form(form) {
	<?php
	if(isset($this->user_reg_extend['jsCheck']['jsCheckboxAndRadio']) and !empty($this->user_reg_extend['jsCheck']['jsCheckboxAndRadio'])) {
		echo implode('', $this->user_reg_extend['jsCheck']['jsCheckboxAndRadio']);
	} ?>

	form.submit();
}

<?php if ($this->success_msg != '') { ?>
show_message('.message_one','<?php echo date("Y-m-d H:i:s",time()); ?>','<?php echo $this->success_msg; ?>','alert-success');
<?php } ?>

//客户删除js
function user_del_js(user_id) {
	if(window.confirm('<?php echo $this->translate('您确实要删除该客户吗？'); ?>')) {
		$.post("<?php echo $this->url('user/default',array('action'=>'del','controller'=>'user')); ?>",{user_id:user_id},
		function(data){
			if(data != 'false') {
				window.location.href='<?php echo $this->url('user/default',array('action'=>'index','controller'=>'user')); ?>';
				return true;
			} else {
				alert('<?php echo $this->translate('客户删除失败！'); ?>');
			}
		});
	}
	return false;
}
<?php if ($this->user_info) { ?>
//载入邮件发送历史列表
dbshop_ajax_list('<?php echo $this->url('user/default/user_id',array('action'=>'maillog','user_id'=>$this->user_info->user_id)); ?>', 'email_log_show');
//载入收藏商品
dbshop_ajax_list('<?php echo $this->url('user/default/user_id',array('action'=>'ajaxfavorites','user_id'=>$this->user_info->user_id)); ?>', 'favorites_show');
//载入会员评价信息
dbshop_ajax_list('<?php echo $this->url('comment/default/user-name',array('action'=>'ajaxcomment','user_name'=>$this->user_info->user_name)); ?>', 'user_comment_show');
//载入会员订单
dbshop_ajax_list('<?php echo $this->url('orders/default/buyer-id',array('controller'=>'Orders','action'=>'ajaxOrderList','buyer_id'=>$this->user_info->user_id)); ?>', 'user_order_show');
//删除邮件历史
function del_mail_log_js(mail_log_id) {
	if(window.confirm('<?php echo $this->translate('您确实要删除该邮件记录吗？'); ?>')) {
		$.post("<?php echo $this->url('user/default',array('action'=>'delmaillog','controller'=>'user')); ?>",{mail_log_id:mail_log_id},
		function(data){
			if(data != 'false') {
				dbshop_ajax_list('<?php echo $this->url('user/default/user_id',array('action'=>'maillog','user_id'=>$this->user_info->user_id)); ?>', 'email_log_show');
				return true;
			} else {
				alert('<?php echo $this->translate('邮件记录删除失败！'); ?>');
			}
		});
	}
	return false;
}

//载入收货地址列表
$("#address_show").load('<?php echo $this->url('user/default/user_id',array('action'=>'address','controller'=>'user','user_id'=>$this->user_info->user_id)); ?>');
//删除收货地址
function del_address_js(address_id) {
	if(window.confirm('<?php echo $this->translate('您确实要删除该收货地址吗？'); ?>')) {
		$.post("<?php echo $this->url('user/default',array('action'=>'deladdress','controller'=>'user')); ?>",{address_id:address_id},
		function(data){
			if(data != 'false') {
				$("#address_show").load('<?php echo $this->url('user/default/user_id',array('action'=>'address','controller'=>'user','user_id'=>$this->user_info->user_id)); ?>');
				return true;
			} else {
				alert('<?php echo $this->translate('收货地址删除失败！'); ?>');
			}
		});
	}
	return false;
}

var SITE_REGION_URL  = '<?php echo $this->url('region/default/region_type',array('action'=>'selectregion','controller'=>'region','module'=>'region','region_type'=>'region_top_id')); ?>';
var AREA_SELECT_LANG = '<?php echo $this->translate('请选择'); ?>';

regionInit("region");

//省市地区
function address_save_js() {
	$.post("<?php echo $this->url('user/default',array('action'=>'saveaddress','controller'=>'user')); ?>",$('#address_add_form').formSerialize(),
	function(data){
		if(data == 'true') {
			$('#myModal').modal('hide');
			$("#address_show").load('<?php echo $this->url('user/default/user_id',array('action'=>'address','controller'=>'user','user_id'=>$this->user_info->user_id)); ?>');
		} else {

		}
	});
}
function ajax_add_address(address_id) {
	$('#address_add_form').resetForm();

	if(address_id != '') {
		$.post('<?php echo $this->url('user/default',array('action'=>'infoaddress','controller'=>'user')); ?>', {'address_id':address_id}, function(data){
			if (data)
			{
				$('#show_address_area').hide();
				$('#show_region_value').show();

				$('#address_id').val(data.address_id);
				$('#true_name').val(data.true_name);
				$('#region_id').val(data.region_id);
				$('#region_value').val(data.region_value);
				$('#address').val(data.address);
				$('#zip_code').val(data.zip_code);
				$('#mod_phone').val(data.mod_phone);
				$('#tel_area_code').val(data.tel_area_code);
				$('#tel_phone').val(data.tel_phone);
				$('#tel_ext').val(data.tel_ext);

				if(data.default_value == 1) {
					$('#addr_default').attr('checked',true);
				} else {
					$('#addr_default').attr('checked',false);
				}

				$('#show_region_value').html(data.region_value+'<input type="button" value="<?php echo $this->translate('编辑'); ?>" class="edit_region" onclick="regionEdit();" />');
			}
		},
		'json');
	} else {
		$('#address_id').val('');
		$('#show_address_area').show();
		$('#show_region_value').hide();
		$('#addr_default').attr('checked',true);
	}
	$('.db_show_area').hide();
	
	$('#myModal').modal('show');
}
<?php } ?>
</script>